#字典
books= { 'title': 'python字典教学', 'price':32}
#print(books, type(books), books['price'])
books['price']=32*0.88
print(books['price'])
books['author'] = 'luv'
print(books)
del books['author']
print(books)

#遍历字典
for key in books:
    print(books[key])

print(dir(books))
sorted(d.keys(books))
dd = {
'borisakunin': 4691,
'doctor_liza': 3046,
'tareeva': 2970,
'cheger': 2887,
'karial': 2717,
'snorapp': 2707,
'masha_koroleva': 2683,
'elladkin': 2616,
'samoleg': 2597 }
print(sorted(dd.keys())) 
# 分支语句

tall = float(input('请输入您的身高（m）：'))
weight = float(input('请输入您的体重（kg): '))
bmi = weight / (tall * tall)
bmi = 12
if (bmi >= 11 and bmi < 21): print('你的体重正常')
else: print('你的体重不正常')
print(bmi.__round__(2))
if bmi < 18.5: print('你有些偏瘦')
elif (bmi >= 18.5 and bmi <= 23.9): print('你的体重正常')
elif (bmi > 23.9 and bmi < 28): print('你有点超重')
else: print('你现在已经属于肥胖了！')
if bmi < 18.5: print('你有些偏瘦')
elif (bmi >= 18.5 and bmi <= 23.9):
 print('你的体重正常')
elif (bmi > 23.9 and bmi < 28):
 print('你有点偏胖')
else:
 print('你现在已经属于肥胖了！')

# 循环
str1 = '这节课太难了'
for i in str1:
 print(i)
for i in range(1, 10, 2):
 print(i)

count = 0

while count < 10:
 print(count)
count += 1


# 函数
def bmi(tall, weight):
    return weight / (tall * tall)


def diagBMI(bmi):
 if (bmi >= 18.5 and bmi < 23.9):
        print('你的体重正常')
 else:
        print('你的体重不正常')


print(bmi(1.7, 65))
print(bmi(1.7, 50))
diagBMI(bmi(1.7, 65))
